# -*-coding=utf-8 -*-

import re


def match_test():

    line = "Cats are smarter than dogs"

    match_obj = re.match(r'(.*) are (.*?) .*', line, re.M | re.I)
    if match_obj:
        print match_obj.groups()
        # print "group0:"+match_obj.group(0)
        # print "group1:"+match_obj.group(1)
    else:
        print "NOT Match"

def replace():
    # re.sub(pattern, repl, string, max=0)
    line = "Cats are smarter than dogs"
    result = re.sub(r'a', " ", line, 0)
    print result

if __name__ == '__main__':
    match_test()
    # replace()